<?php

namespace Home\Controller;

use Think\Controller;

class BaseController extends Controller {

    static protected $user_id = 0;
    static protected $user_name = '';
    static protected $email = '';

    public function __construct() {
        parent::__construct();
        $this->setUserInfo();
        if (!session('userinfo')) {
            $this->redirect('Account/login');
        }
    }

    static function setUserInfo() {
        self::$user_id = session('userinfo.id');
        self::$user_name = session('userinfo.name');
        self::$email = session('userinfo.email');
    }

}
